##geo_regressions_master.r

##how many sims
n.sims = 2000

ylims = c(0,1) ##for plots
dict.ylims = c(-5,10)
dict.ylims.subset = c(-5,20)
ylims.close = c(0,1)
pdf.width = 5
pdf.height = 5
cex.axis = 1.5
cex.lab = 1.75


##how big of confidence intervals?
high.conf = .95
low.conf = .05


##simulation values
mean.seg.value = .65
uo.homo.value = .73 
sec.homo.value = .27   


sex = 'male'
age = 40
ethnicity = 'ash'
ideology = 5.2
income.value = 'low'
college.value = 0
nonjewish_pcnt.value = .06
immigrant = 0


##data needed for each
master.use.vars = c('outgroup.dissim.yeshiva','outgroup.yeshiva','demo1.sex','demo1.age','demo1.ethnicity','demo2.left_right','index.city','nonjewish_pcnt','income','college','immigrant','jerusalem')
master.formula = 'outgroup.dissim.yeshiva*outgroup.yeshiva+demo1.sex+demo1.age+demo1.ethnicity+demo2.left_right+income+college+immigrant+nonjewish_pcnt+jerusalem'
master.formula.reduced = 'outgroup.dissim.yeshiva*outgroup.yeshiva'

##names for regression tables
coef.names = c('Intercept', 'Segregation', 'Outgroup Proportion',  'Segregation x Outgroup Proportion', 'Male', 'Age', 'Mixed Ethnicity', 'Other Ethnicity', 'Sephardic Ethnicity', 'Political Ideology','High Income','Low Income','College','Immigrant','Arab Population','Jerusalem')


##for zelig scaling
##these are used for scaling below
dissim.scale.uo = seq(from = .288, to = .63, by = .01) 
homo.scale.uo = seq(from = .67, to = .99, by = .01)
dissim.scale.sec = seq(from = .288, to = .63, by = .01)
homo.scale.sec = seq(from = .01, to = .33, by = .01)

##for plotting
xlims.dissim.uo = c(min(dissim.scale.uo),max(dissim.scale.uo))
xlims.dissim.sec = c(min(dissim.scale.sec),max(dissim.scale.sec))
xlims.homo.uo = c(min(homo.scale.uo),max(homo.scale.uo))
xlims.homo.sec = c(min(homo.scale.sec),max(homo.scale.sec))

###source files
source('scripts/geo_regressions_output_public.r')
source('scripts/geo_regressions_output_dictator.r')
source('scripts/geo_regressions_output_task.r')

###############
##create omnibus table
coef.names.omni = c('Intercept', 'Segregation', 'Outgroup Proportion',  'Male', 'Age', 'Mixed Ethnicity', 'Other Ethnicity', 'Sephardic Ethnicity', 'Political Ideology','High Income','Low Income','College','Immigrant','Arab Population','Jerusalem','Segregation x Outgroup Proportion')

outtable = apsrtable(reg.uo.pub,
                     reg.sec.pub,
                     reg.uo.dict,
                     reg.sec.dict,
                     reg.uo.task,
                     reg.sec.task,
                     Sweave = T,
                     coef.names = coef.names.omni,
                     model.names = c('UO','Non UO','UO','Non UO','UO','Non UO'),
                     notes = ''
)
writeLines(
  outtable, 'output/Table_2.tex')


